// MainDlg.h : interface of the CMainDlg class
//
/////////////////////////////////////////////////////////////////////////////

#pragma once
#include <list>
#define MOD_TODAY 1
#define MOD_CHOOSE 2
class CMainDlg : public CDialogImpl<CMainDlg>, public CUpdateUI<CMainDlg>,
		public CMessageFilter, public CIdleHandler, public CWinDataExchange<CMainDlg>
{
public:
	enum { IDD = IDD_MAINDLG };

	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL OnIdle();

	BEGIN_UPDATE_UI_MAP(CMainDlg)
	END_UPDATE_UI_MAP()

	BEGIN_MSG_MAP(CMainDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
		COMMAND_ID_HANDLER(IDOK, OnOK)
		COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
		COMMAND_HANDLER(IDC_RADIO_TODAY, BN_CLICKED, OnBnClickedRadioToday)
		COMMAND_HANDLER(IDC_RADIO_CHOOSEDATE, BN_CLICKED, OnBnClickedRadioChoosedate)
		COMMAND_HANDLER(IDC_BUTTON_OPEN, BN_CLICKED, OnBnClickedButtonOpen)
		REFLECT_NOTIFICATIONS()
	END_MSG_MAP()

	BEGIN_DDX_MAP(CMainDlg)
//		DDX_CONTROL_HANDLE(IDC_DATETIMEPICKER1, m_DateTimeCtrlStrat)
//		DDX_CONTROL_HANDLE(IDC_DATETIMEPICKER2, m_DateTimeCtrlEnd)
	END_DDX_MAP()

// Handler prototypes (uncomment arguments if needed):
//	LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
//	LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
//	LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnBnClickedRadioToday(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnBnClickedRadioChoosedate(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);


	void CloseDialog(int nVal);
public:
	CMainDlg();
	typedef std::list<CString> nameList;
	int GetLogNameList(nameList &loglist,LPCTSTR time1,LPCTSTR time2 = NULL);
	BOOL PackLog();
	BOOL ResolveDate(LPCTSTR date,int &year,int &month,int&day);
	BOOL FileINeed(LPCTSTR filePath,LPCTSTR time1,LPCTSTR time2 = NULL,BOOL flag = FALSE );
	BOOL CheckTime(SYSTEMTIME tiem1,SYSTEMTIME time2);
	void SetLanuage();

private:
	
	nameList m_logNameList;
	nameList m_logNameList_route;
	CTime m_time;
	CString m_strDate;
	CString m_strDate2;
	CString m_strLogPath;
	CString m_strLogPath_route;
	CString m_strClientPath;
	CString m_sOutputFolder;
	CString m_strMessage;
	int m_mod;
	CDateTimePickerCtrl  m_DateTimeCtrlStrat;
	CDateTimePickerCtrl  m_DateTimeCtrlEnd;
	int m_iLanuge;
	CXPButton m_btnOK, m_btnBrowse;
	
	LRESULT OnBnClickedButtonOpen(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
